﻿<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新人祝福</title>
<link href="<?php echo __TEMPLATE__?>/css/index.css" rel="stylesheet" type="text/css"/>
<link href="resource/hdjs/css/bootstrap.min.css" rel="stylesheet">
<link href="resource/hdjs/css/font-awesome.min.css" rel="stylesheet">
<script src="resource/hdjs/js/jquery.min.js"></script>
<script src="resource/hdjs/app/util.js"></script>
<script src="resource/hdjs/require.js"></script>
<script src="resource/hdjs/app/config.js"></script>
</head>

<body ng-controller="ctrl" id="hd">
	<div ng-repeat="v in data" class="qiqiu{{v.xuhao}} qiqiu">
    	<img ng-="<?php echo __TEMPLATE__?>/images/{{v.xuhao}}.png"/>
        <div class="text" ng-bind="v.content"></div>
    </div>
	
	<div class="yun1 yun"> </div>
	<div class="yun2 yun"> </div>
	<div class="yun3 yun"> </div>	
	<div class="yun4 yun"> </div>
</body>
<script>
	require(['angular', 'util'], function (angular, util) {
		angular.module('app', []).controller('ctrl', ['$scope','$interval', function ($scope,$interval) {
			$scope.data =[];
			$scope.pos = 1;
			$scope.time = function () {
				$.get('<?php echo web_url("site/get")?>',{"pos": $scope.pos},function (res) {
//				    判断数组不为空的情况下进行添加
					if(res.pos != $scope.pos){
						$(res.data).each(function (i) {
							console.log(res.data[i]);
							$scope.data.push(res.data[i]);
						})
						$scope.pos = res.pos;

						$scope.$apply();
					}
				})
			}
			var timesId = $interval(function () {
				$scope.time();
			},2000)

		}]);
		angular.bootstrap(document.getElementById('hd'), ['app']);
	})
</script>
</html>

